<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="css/excite-bike/jquery-ui-1.8.22.custom.css" rel="stylesheet" type="text/css" />
<link href="css/table.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/jquery-ui-1.8.22.custom.min.js"></script>
<script src="js/jquery.cookie.js"></script>
<script src="js/widgets.js"></script>
<title>人員維護資訊</title>
<script type="text/javascript">

	function updateUser(userID) {
		$.cookie("currStatus", "updateUser");
		$.cookie("upadateUserID", userID);
		window.location = "CreateUser.html";
	}

	function deleteUser(userID,nickName) {
		var str = "確定刪除"+userID + " (" + nickName +" ) ？";
		$("#deleteUserID").html = str;
		$("#dialog-deleteUser").dialog({
			resizable : true,
			width : 400,
			height : 400,
			modal : true,
			buttons : {
				"確定刪除" : function() {
					$("#sub_userID")[0].value = userID;
					
					$.ajax({
						type : "post",
						url : "DeleteUser",
						data : $("#q_form").serializeArray(),
						dataType : "TEXT",
						success : function(Result) {
							alert(Result);
						}
					});
					
					$(this).dialog("close");
				},"關閉" : function() {
					$(this).dialog("close");
				}
			}
		});	
	}


	$(document).ready(function() {
		$("#loginUser")[0].value = $.cookie("userID");
		$("#sub_GroupList")[0].value ="";
		$("#dialog-Group").css("visibility", "hidden");
		$("#dialog-deleteUser").css("visibility", "hidden");
		$("button").button();
		$("#square").css("visibility", "hidden");
		$("input[id$=Date]").datepicker({
			dateFormat : "yy-mm-dd"
		});
	});

</script>

</head>
<body>
	<form id="q_form" method="post">
		<table>
			<tr>
				<th colspan="2" valign="middle" scope="col">請輸入查詢條件</th>
			</tr>
			<tr>
				<th valign="middle" scope="col">
					<div align="right">人員ID：</div>
				</th>
				<td scope="col"><div align="left">
					<input type="text" name="q_userID" id="q_userID" class="require_from_group" />
					</div></td>
			</tr>
			<tr>
				<th valign="middle"><div align="right">擁有的角色：</div></th>
				<td>
					<button type="button" id="clickGroup" onClick="click_SelectRole()">選擇</button>
					<ul id='selectedRole'></ul>
				</td>
			</tr>
			<tr>
				<th rowspan="2" valign="middle"><div align="right">建立日期：</div>
					<div align="right"></div></th>
				<td bgcolor="#CCCCCC">
					起：<input type="text" name="q_cfromDate" id="q_cfromDate" class="require_from_group" />
				</td>
			</tr>
			<tr>
				<td>
					迄：<input type="text" name="q_ctoDate" id="q_ctoDate" class="require_from_group" />
				</td>
			</tr>
			<tr>
				<th>&nbsp;</th>
				<td bgcolor="#CCCCCC">
					<button type="button" id="clickS" onClick="Click_QueryUser()">送出查詢</button>
					<button type="button" id="clickReset" onClick="Click_Reset()">重設</button>
				</td>
			</tr>
			<tr>
				<th>&nbsp;</th>
				<td id="q_message" class="require_from_group">&nbsp;</td>
			</tr>
		</table>
		<input type="hidden" id="sub_GroupList" name="groupList" />			<!-- 測試案負責人 -->
		<input type="hidden" id="sub_userID" name="userID" />							<!-- 要查詢的後端角色為 -->		
		<input type="hidden" id="loginUser" name="loginUser" />
	</form>
	
	<div id="square">
		<p>&nbsp;</p>
		<h2 id="ReaultNum"></h2>
		<hr />

		<table id="resultTable">
			<thead id="resultTable_h">
				<tr>
					<th>#</th>
					<th>人員ID</th>
					<th>人員名稱</th>
					<th>&nbsp;</th>
				</tr>
			</thead>
			
			<tbody id="resultTable_b">
			</tbody>
		</table>
	</div>
	
	<div id="dialog-deleteUser" title="刪除使用者">
		<div id="deleteUserID"></div> ?
	</div>
	
	<div id="dialog-Group" title="勾選相關角色">
		<table>
			<thead>
				<tr>
					<th><input type="checkbox" id="selectedRoleCheckALL" onClick="chkALL('selectedRole')" /></th>
					<th>#</th>
					<th>角色描述</th>
				</tr>
			</thead>
			
			<tbody id="selectRole">
			
			</tbody>
		</table>
	</div>

	<div id="message"></div>
	<div id="errorMessage" class="alertText"></div>
</body>
</html>